package com.lazily.map_;


import java.util.HashMap;

/**
 * @Author:  GZQ
 * @date:  2025/6/3 20:55
 * @description: 模拟 HashMap触发扩容、树化情况
 * @version: 1.0
 */


@SuppressWarnings({"all"})
public class HashMapSource2 {
	// 程序入口
	public static void main(String[] args) {
		HashMap hashMap = new HashMap();

		for (int i = 0; i <= 12; i++) {
			hashMap.put(i, "hello");
		}

		hashMap.put("aaa", "bbb");

		System.out.println("hashMap=" + hashMap); // 12 K-V
	}
}


@SuppressWarnings({"all"})
class A {
	private int num;

	public A(int num) {
		this.num = num;
	}


	// 所有的A对象的 hashCode 都是 100
	@Override
	public int hashCode() {
		return 100;
	}


	@Override
	public String toString() {
		return "\nA{" +
				"num=" + num +
				'}';
	}
}
